/* eslint-disable */
// 该文件由 OneAPI 自动生成，请勿手动修改！
import { request } from '@umijs/max';
import {apiPrefixDispose} from "@/utils/format";

/** 获取Docker Compose列表 */
export async function listComposes(
    type: 'base' | 'app',
    options?: { [key: string]: any },
) {
  return request<API.ResultVO<API.DockerComposeVO[]>>(apiPrefixDispose('/docker/composes'), {
    method: 'GET',
    params: { type },
    ...(options || {}),
  });
}



/** 获取Docker网络列表 */
export async function listNetworks(options?: { [key: string]: any }) {
  return request<API.ResultVO<API.NetworkVariable[]>>(apiPrefixDispose('/docker/networks'), {
    method: 'GET',
    ...(options || {}),
  });
}


/** 更新容器配置 */
export async function updateContainer(
    id: string,
    data: Partial<API.DockerComposeVO>,
    options?: { [key: string]: any }
) {
  return request<API.ResultVO<void>>(apiPrefixDispose(`/docker/container/${id}`), {
    method: 'PUT',
    data,
    ...(options || {}),
  });
}



/** 启动容器 */
export async function startContainer(id: string, options?: { [key: string]: any }) {
  return request<API.ResultVO<void>>(apiPrefixDispose(`/docker/container/${id}/start`), {
    method: 'POST',
    ...(options || {}),
  });
}

/** 停止容器 */
export async function stopContainer(id: string, options?: { [key: string]: any }) {
  return request<API.ResultVO<void>>(apiPrefixDispose(`/docker/container/${id}/stop`), {
    method: 'POST',
    ...(options || {}),
  });
}

/** 重启容器 */
export async function restartContainer(id: string, options?: { [key: string]: any }) {
  return request<API.ResultVO<void>>(apiPrefixDispose(`/docker/container/${id}/restart`), {
    method: 'POST',
    ...(options || {}),
  });
}

/** 重建容器 */
export async function rebuildContainer(id: string, options?: { [key: string]: any }) {
  return request<API.ResultVO<void>>(apiPrefixDispose(`/docker/container/${id}/rebuild`), {
    method: 'POST',
    ...(options || {}),
  });
}
